
 
 var createButton = function ( Text ) {

    // Pre creation of Text
    var LabelTTF = cc.LabelTTF.create(Text, "Arial", 17);
    LabelTTF.setAnchorPoint(cc.p(0, 0.5));
    LabelTTF.setPosition(cc.p(18,0));
    
    var TextSize = LabelTTF.getBoundingBox().size;
    
    // compute Scale of Center from Text
    var ScaleX = TextSize.width / 30;
    

    // Node Base
    var Button = cc.Node.create();
    
    // Backgrounf Left
    var tmp = cc.Sprite.create("res/TextBox_2_L.png");
    tmp.setAnchorPoint(cc.p(0, 0.5));
    Button.addChild(tmp);

    // Backgrounf Center
    tmp = cc.Sprite.create("res/TextBox_2_C.png");
    tmp.setAnchorPoint(cc.p(0, 0.5));
    tmp.setPosition(cc.p(18,0));
    
    tmp.setScale(ScaleX,1);
    Button.addChild(tmp);
    
    // Backgrounf right
    tmp = cc.Sprite.create("res/TextBox_2_R.png");
    tmp.setAnchorPoint(cc.p(0, 0.5));
    tmp.setPosition(cc.p(18+(30*ScaleX),0));
    Button.addChild(tmp);
    
    // Text
    Button.addChild(LabelTTF);
    
    
    
    
    
    // Button Node Normal
    var ButtonNormal = cc.Node.create();
    ButtonNormal.addChild(Button);
    
    // Button Node Selected
    var ButtonSel = cc.Node.create();
    ButtonSel.addChild(Button);
    ButtonSel.setPosition(cc.p(5,0));
    
    
    // Item and Menu
    var item = cc.MenuItemNode.create(
        ButtonNormal,
        ButtonSel
    );
    
    return item;
};
